<template>
  <view>
    <view class="live_header">
      <view class="user_wrap">
        <img
          class="avatar"
          :src="userInfo.avatar"
          v-if="Object.keys(userInfo).length > 0"
        />
        <img class="avatar"  v-else />
        <text class="shopname">{{ shopname }}</text>
      </view>
      <view class="person_wrap">
        <u-icon
          class="search_icon"
          name="search"
          size="24"
          @click="GotoSearchPage"
        ></u-icon>
        <text @click="userFollow">关注</text>
        <text class="division_line">|</text>
        <text @click="reLaunch('/pages/my/index')">个人中心</text>
      </view>
    </view>
  </view>
</template>

<script>
import { api_getshopname } from "@/api/product.js";
export default {
  data() {
    return {
      shopname: "",
      userInfo: {},
    };
  },
  created() {
    this.query();
  },
  methods: {
    async query() {
      let res = await api_getshopname({ shop_name: "db" });
      this.shopname = res.data.shopname;
    },
    reLaunch(url) {
      uni.reLaunch({
        url: url,
      });
    },
    GotoSearchPage() {
      //	搜索
      //   console.log("search");
      uni.navigateTo({ url: "/pages/searchList/index" });
    },
  },
};
</script>

<style lang="less" scoped>
.live_header {
  display: flex;
  height: 50px;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #eee;
  padding: 0 10px;
  box-sizing: border-box;
  .user_wrap {
    display: flex;
    align-items: center;
    .avatar {
      display: block;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      margin: 0 10px 0 0;
    }
    .shopname {
      font-size: 14px;
    }
  }
  .person_wrap {
    display: flex;
    align-items: center;
    font-size: 12px;
    .search_icon {
      display: inline-block;
      margin: 0 5px 0 0;
      color: #ccc !important;
    }
    .division_line {
      display: inline-block;
      margin: 0 4px;
    }
  }
}
</style>